<?php

class Kd_Data_Factory {

    private static $_parsers = array();

    public static function getInsertDcl(){
        return new Kd_Data_Dcl_Insert();
    }

    public static function getUpdateDcl(){
        return new Kd_Data_Dcl_Update();
    }

    public static function getDeleteDcl(){
        return new Kd_Data_Dcl_Delete();
    }

    public static function getQueryDcl(){
        return new Kd_Data_Dcl_Query();
    }

    public static function getInsertParser(){
        return self::createParser('insert', Kd_Data_Config::getInsertParserClass());
    }

    public static function getUpdateParser(){
        return self::createParser('insert', Kd_Data_Config::getUpdateParserClass());
    }

    public static function getDeleteParser(){
        return self::createParser('insert', Kd_Data_Config::getDeleteParserClass());
    }

    public static function getQueryParser(){
        return self::createParser('insert', Kd_Data_Config::getQueryParserClass());
    }

    private static function createParser($name, $class){
        if(!isset(self::$_parsers[$name])){
            self::$_parsers[$name] = new $class();
        }
        return self::$_parsers[$name];        
    }
}

